package com.example.communist_app_api.service.impl;

import com.example.communist_app_api.db.dao.LikeDao;
import com.example.communist_app_api.service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class LikeServiceImpl implements LikeService {

    @Autowired
    private LikeDao likeDao;

    @Override
    public int getLikeNum(Integer id) {
        int num = likeDao.getLikeNum(id);
        return num;
    }

    @Override
    public int insertLike(Integer userId, Integer articleId) {
        int intNum = likeDao.insertLike(userId, articleId);
        return intNum;
    }

    @Override
    public int deleteLike(Integer userId, Integer articleId) {
        int deleteNum = likeDao.deleteLike(userId, articleId);
        return deleteNum;
    }

    @Override
    public Boolean judgmentLike(Integer userId, Integer id) {
        return likeDao.judgmentLike(userId, id);
    }
}
